# coding=utf-8
import multiprocessing
import os
import sys

port = os.getenv("PORT", "9001")
bind = f"0.0.0.0:{port}"
accesslog = "-"

cpu_count = multiprocessing.cpu_count()
# 启动的进程数
workers = os.getenv("WEB_WORKS", cpu_count)
# 线程数
# threads = os.getenv("WEB_THREADS", cpu_count * 15)

access_log_format = "%({X-Forwarded-For}i)s   %(t)s   %(r)s   %(s)s   %(b)s   %(f)s   %(a)s   %({UID}i)s   %({DID}i)s   %(L)s"

if "asgi" in ' '.join(sys.argv):
    worker_class = 'gunicorn_workers.UvicornWorker'
    print("asgi 'gunicorn_workers.UvicornWorker' ")
else:
    worker_class = 'gthread'
    print("wsgi 'gthread' ")


keepalive = 30

max_requests = "200000"
max_requests_jitter = "10000"
